﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Users;

namespace WanPiJie.AccountSite.Models
{
	/// <summary>
	/// 社交账号模型
	/// </summary>
	public class SnsAccountModel : ViewModel
	{
		private List<UserSns> m_UserSnsList;
		private Dictionary<int, UserSns> m_UserSnsDict;

		public List<UserSns> UserSnsList
		{
			get { return m_UserSnsList; }
			set
			{
				m_UserSnsList = value;
				m_UserSnsDict = m_UserSnsList.ToDictionary(p => p.SnsType, p => p);
			}
		}

		public UserSns Weibo
		{
			get
			{
				if (m_UserSnsDict.ContainsKey((int)SnsType.Weibo))
				{
					return m_UserSnsDict[(int)SnsType.Weibo];
				}
				else
				{
					return null;
				}
			}
		}

		public UserSns Qzone
		{
			get
			{
				if (m_UserSnsDict.ContainsKey((int)SnsType.Qzone))
				{
					return m_UserSnsDict[(int)SnsType.Qzone];
				}
				else
				{
					return null;
				}
			}
		}

		public UserSns Taobao
		{
			get
			{
				if (m_UserSnsDict.ContainsKey((int)SnsType.Taobao))
				{
					return m_UserSnsDict[(int)SnsType.Taobao];
				}
				else
				{
					return null;
				}
			}
		}
	}


}